package com.example.medmobile.profissional;

import WebService.SoapWebService;
import android.app.ProgressDialog;
import android.content.Context;

import com.example.medmobile.Global;
import com.google.appengine.medmobileserver.business.Profissional;

public class ListaAgendamentoProfissionalHandler extends AgendaProfissional {

	@Override
	protected void CarregaLista(final String sData, final Context context) {
		try {
			String s = "";
			dialog = ProgressDialog.show(context, "Caixa entrada",
					"Carregando agendamentos.", true, false);
			new Thread() {
				public void run() {
					Profissional p = Global.getProfissionalLogado();
					li = SoapWebService.BuscaAgendamentosProfissional(
							p.getIdProfissional(), sData);
					runOnUiThread(new Runnable() {

						public void run() {
							try {
								ListaAgendamentoProfissionalAdapter ra = new ListaAgendamentoProfissionalAdapter(
										context, li);
								listView.setAdapter(ra);
							} finally {
								handler.post(new Runnable() {

									@Override
									public void run() {
										dialog.dismiss();

									}
								});

							}
						}
					});

				}
			}.start();

		} catch (Exception e) {
			e.getMessage();
		}
	}

}
